package com.region.spring.cloud.core;

import com.region.loadbalancer.monitor.stat.SocketDetectionConnection;
import com.region.loadbalancer.policy.RandomPolicy;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author liujieyu
 * @date 2024/10/21 19:06
 * @desciption
 */
@Component
@ConfigurationProperties(prefix = "region.cloud")
public class RegionCloudAdapterProperties {

    private boolean autoDetect;

    private String detectionConnectionClassName = SocketDetectionConnection.class.getName();

    private String balancerPolicyClassName = RandomPolicy.class.getName();

    private boolean detectOnBorrow;

    // default 30 seconds
    private int refreshTime = 30;

    public boolean isAutoDetect() {
        return autoDetect;
    }

    public void setAutoDetect(boolean autoDetect) {
        this.autoDetect = autoDetect;
    }

    public String getDetectionConnectionClassName() {
        return detectionConnectionClassName;
    }

    public void setDetectionConnectionClassName(String detectionConnectionClassName) {
        this.detectionConnectionClassName = detectionConnectionClassName;
    }

    public String getBalancerPolicyClassName() {
        return balancerPolicyClassName;
    }

    public void setBalancerPolicyClassName(String balancerPolicyClassName) {
        this.balancerPolicyClassName = balancerPolicyClassName;
    }

    public boolean isDetectOnBorrow() {
        return detectOnBorrow;
    }

    public void setDetectOnBorrow(boolean detectOnBorrow) {
        this.detectOnBorrow = detectOnBorrow;
    }

    public int getRefreshTime() {
        return refreshTime;
    }

    public void setRefreshTime(int refreshTime) {
        this.refreshTime = refreshTime;
    }
}
